<p>Couldn't you set the password to a variable on the login page if it is the correct intranet url?</p>

<pre><code>{% if craft.request.getUrl() == "intranet.net" %}
 {% set pass = "password" %}
{% endif %}

&lt;input type="password" value="{{ pass|default('') }} name="password" /&gt;
</code></pre>

CC BY-SA 3.0
2015-07-29T19:42:36.477Z
Thanks for the response @aran . I think what I was actually looking for was `{% if craft.request.getUrlReferrer == "intranet.net" %}` since I want to fill the password for users who are visiting the site via a link from the intranet. Thanks for sending me down this path!
nickespi
CC BY-SA 3.0
2015-07-29T17:30:39.347Z
2015-07-29T17:39:07.010Z
2015-07-29T17:39:07.010Z
a-am
<p>The above answer is great, but I'd just like to add that if the client site is public, and the company have a set of internal static IPs that users would always be accessing it from then I would add an IP check to the if statement.</p>

<p>By using only getUrl() someone accessing the site could simply add an entry to their host file to use that URL, and the login box would be auto populated. I realise that may be a fringe case, but you can never be too careful.</p>

CC BY-SA 3.0
2015-08-03T11:25:21.723Z
2015-08-03T11:25:21.723Z
Ian Nebbiolo
<p>My client has a private Craft site only accessible to their employees. To access the site they all use the same username and password on a front-end login form. They are now wanting to link to this site from their intranet and have the username and password form values auto-populated (only when accessed from the intranet). I have come up with a way using a Craft route (example.com/login/user/username/password/actualpassword) and craft.request.segment to auto-populate the form input values. This works but I was wondering if anyone else has a solution that doesn't require the password being in the URL.</p>

<p>Thanks!</p>

<form><login>
Auto-populate login form when accessed via client intranet
# Auto-populate login form when accessed via client intranet

(Asked by: username_0 on 2015-07-29)

My client has a private Craft site only accessible to their employees. To access the site they all use the same username and password on a front-end login form. They are now wanting to link to this site from their intranet and have the username and password form values auto-populated (only when accessed from the intranet). I have come up with a way using a Craft route (example.com/login/user/username/password/actualpassword) and craft.request.segment to auto-populate the form input values. This works but I was wondering if anyone else has a solution that doesn't require the password being in the URL.

Thanks!

**Tags:** form, login


---

## 2 answers

### Answer by username_1 on 2015-07-29. Score: 3 | Accepted answer

Couldn't you set the password to a variable on the login page if it is the correct intranet url?
{% if craft.request.getUrl() == "intranet.net" %}
 {% set pass = "password" %}
{% endif %}

> **Comments:**
> **username_0**: Thanks for the response @aran . I think what I was actually looking for was `{% if craft.request.getUrlReferrer == "intranet.net" %}` since I want to fill the password for users who are visiting the site via a link from the intranet. Thanks for sending me down this path!  

---

### Answer by username_2 on 2015-08-03. Score: 1

The above answer is great, but I'd just like to add that if the client site is public, and the company have a set of internal static IPs that users would always be accessing it from then I would add an IP check to the if statement.

By using only getUrl() someone accessing the site could simply add an entry to their host file to use that URL, and the login box would be auto populated. I realise that may be a fringe case, but you can never be too careful.


---

