|
| 1 | +<?php declare(strict_types=1); |
| 2 | + |
| 3 | +$this->data['header'] = $this->t('{cesnet:einfra:user_pass_header}'); |
| 4 | + |
| 5 | +if (strlen($this->data['username']) > 0) { |
| 6 | + $this->data['autofocus'] = 'password'; |
| 7 | +} else { |
| 8 | + $this->data['autofocus'] = 'username'; |
| 9 | +} |
| 10 | + |
| 11 | +$this->includeAtTemplateBase('includes/header.php'); |
| 12 | + |
| 13 | +if ($this->data['errorcode'] !== null) { |
| 14 | + ?> |
| 15 | + <div class="alert alert-danger"> |
| 16 | + <span class="glyphicon glyphicon-exclamation-sign" |
| 17 | + style="float:left; font-size: 38px; margin-right: 10px;"></span> |
| 18 | + |
| 19 | + <strong> |
| 20 | + <?php |
| 21 | + echo htmlspecialchars($this->t('{cesnet:einfra:loginuserpass_error_title}')); ?> |
| 22 | + </strong> |
| 23 | + |
| 24 | + <p> |
| 25 | + <?php |
| 26 | + echo htmlspecialchars($this->t('{cesnet:einfra:loginuserpass_error_text}')); ?> |
| 27 | + </p> |
| 28 | + </div> |
| 29 | + |
| 30 | + <?php |
| 31 | +} |
| 32 | +?> |
| 33 | + |
| 34 | + <p><?php echo $this->t('{cesnet:einfra:user_pass_text}'); ?></p> |
| 35 | + |
| 36 | + <br> |
| 37 | + |
| 38 | + <form action="?" method="post" name="f" class="form-horizontal"> |
| 39 | + |
| 40 | + <div class="form-group"> |
| 41 | + <label for="username" class="col-sm-2 control-label"> |
| 42 | + <?php echo $this->t('{cesnet:einfra:username}'); ?> |
| 43 | + </label> |
| 44 | + <div class="col-sm-10"> |
| 45 | + <input id="username" <?php echo ($this->data['forceUsername']) ? 'disabled="disabled"' : ''; ?> |
| 46 | + type="text" name="username" class="form-control" |
| 47 | + <?php |
| 48 | + if (! $this->data['forceUsername']) { |
| 49 | + echo 'tabindex="1"'; |
| 50 | + } |
| 51 | + ?> value="<?php echo htmlspecialchars($this->data['username']); ?>"/> |
| 52 | + </div> |
| 53 | + </div> |
| 54 | + |
| 55 | + <div class="form-group"> |
| 56 | + <label for="password" class="col-sm-2 control-label"><?php echo $this->t('{login:password}'); ?></label> |
| 57 | + <div class="col-sm-10"> |
| 58 | + <input id="password" type="password" tabindex="2" name="password" class="form-control"/> |
| 59 | + </div> |
| 60 | + </div> |
| 61 | + |
| 62 | + <?php |
| 63 | + if ($this->data['rememberUsernameEnabled'] && ! $this->data['forceUsername']) { |
| 64 | + // display the "remember my username" checkbox?> |
| 65 | + <div class="form-group"> |
| 66 | + <div class="col-sm-offset-2 col-sm-10"> |
| 67 | + <div class="checkbox"> |
| 68 | + <label> |
| 69 | + <input type="checkbox" id="remember_username" tabindex="4" |
| 70 | + <?php echo ($this->data['rememberUsernameChecked']) ? 'checked="checked"' : ''; ?> |
| 71 | + name="remember_username" value="Yes"/> |
| 72 | + <?php echo $this->t('{login:remember_username}'); ?> |
| 73 | + </label> |
| 74 | + </div> |
| 75 | + </div> |
| 76 | + </div> |
| 77 | + <?php |
| 78 | + } |
| 79 | + ?> |
| 80 | + |
| 81 | + <?php |
| 82 | + if ($this->data['rememberMeEnabled']) { |
| 83 | + // display the remember me checkbox (keep me logged in)?> |
| 84 | + <div class="form-group"> |
| 85 | + <div class="col-sm-offset-2 col-sm-10"> |
| 86 | + <div class="checkbox"> |
| 87 | + <label> |
| 88 | + <input type="checkbox" id="remember_me" tabindex="5" |
| 89 | + <?php echo ($this->data['rememberMeChecked']) ? 'checked="checked"' : ''; ?> |
| 90 | + name="remember_me" value="Yes"/> |
| 91 | + <?php echo $this->t('{login:remember_me}'); ?> |
| 92 | + </label> |
| 93 | + </div> |
| 94 | + </div> |
| 95 | + </div> |
| 96 | + <?php |
| 97 | + } |
| 98 | + ?> |
| 99 | + |
| 100 | + <?php |
| 101 | + if (array_key_exists('organizations', $this->data)) { |
| 102 | + ?> |
| 103 | + <div class="form-group"> |
| 104 | + <label for="organization" |
| 105 | + class="col-sm-2 control-label"><?php echo $this->t('{login:organization}'); ?></label> |
| 106 | + <div class="col-sm-10"> |
| 107 | + <select name="organization" tabindex="3" class="form-control"> |
| 108 | + <?php |
| 109 | + if (array_key_exists('selectedOrg', $this->data)) { |
| 110 | + $selectedOrg = $this->data['selectedOrg']; |
| 111 | + } else { |
| 112 | + $selectedOrg = null; |
| 113 | + } |
| 114 | + |
| 115 | + foreach ($this->data['organizations'] as $orgId => $orgDesc) { |
| 116 | + if (is_array($orgDesc)) { |
| 117 | + $orgDesc = $this->t($orgDesc); |
| 118 | + } |
| 119 | + |
| 120 | + if ($orgId === $selectedOrg) { |
| 121 | + $selected = 'selected="selected" '; |
| 122 | + } else { |
| 123 | + $selected = ''; |
| 124 | + } |
| 125 | + |
| 126 | + echo '<option ' . |
| 127 | + $selected . 'value="' . htmlspecialchars($orgId) . '">' . htmlspecialchars($orgDesc) . |
| 128 | + '</option>'; |
| 129 | + } ?> |
| 130 | + </select> |
| 131 | + </div> |
| 132 | + </div> |
| 133 | + <?php |
| 134 | + } |
| 135 | + ?> |
| 136 | + |
| 137 | + <div class="form-group"> |
| 138 | + <div class="col-sm-offset-2 col-sm-10"> |
| 139 | + <button class="btn btn-success" |
| 140 | + onclick="this.value='<?php echo $this->t('{login:processing}'); ?>'; |
| 141 | + this.disabled=true; this.form.submit(); return true;" tabindex="6"> |
| 142 | + <?php echo $this->t('{login:login_button}'); ?> |
| 143 | + </button> |
| 144 | + </div> |
| 145 | + </div> |
| 146 | + |
| 147 | + <?php |
| 148 | + foreach ($this->data['stateparams'] as $name => $value) { |
| 149 | + echo '<input type="hidden" name="' . htmlspecialchars($name) . |
| 150 | + '" value="' . htmlspecialchars($value) . '" />' |
| 151 | + ; |
| 152 | + } |
| 153 | + ?> |
| 154 | + </form> |
| 155 | + |
| 156 | +<?php |
| 157 | + |
| 158 | +if (! empty($this->data['links'])) { |
| 159 | + echo '<ul class="links" style="margin-top: 2em">'; |
| 160 | + foreach ($this->data['links'] as $l) { |
| 161 | + echo '<li>' . |
| 162 | + '<a href="' . htmlspecialchars($l['href']) . '">' . htmlspecialchars($this->t($l['text'])) . '</a>' . |
| 163 | + '</li>'; |
| 164 | + } |
| 165 | + echo '</ul>'; |
| 166 | +} |
| 167 | + |
| 168 | +$this->includeAtTemplateBase('includes/footer.php'); |
0 commit comments