-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathauth.njk
86 lines (78 loc) · 3.21 KB
/
auth.njk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<html>
<head>
<title>{{ translations.authTitle }}</title>
</head>
<body>
<div class="form-header">
<h2>{{ translations.authHeader }}</h2>
<ul class="errors-list">
{% for location, error in errors %}
<li>{{ error.msg }}</li>
{% endfor %}
</ul>
</div>
<p>
<a href='//www.microsoft.com/store/apps/9nhdtxbjppxn?cid=storebadge&ocid=badge'><img src='https://developer.microsoft.com/store/badges/images/English_get-it-from-MS.png' alt='English badge' style='width: 284px; height: 104px;'/></a>
<br>
<a href='https://play.google.com/store/apps/details?id=net.leveugle.teslatokens&hl=en_US&gl=US&pcampaignid=pcampaignidMKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img alt='Get it on Google Play' style='width: 250px' src='https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png'/></a>
<br>
<a href="https://apps.apple.com/us/app/authla/id1546597644?itsct=apps_box_badge&itscg=30200" style="display: inline-block; overflow: hidden; border-radius: 13px; width: 250px; height: 83px;"><img src="https://tools.applemediaservices.com/api/badges/download-on-the-app-store/black/en-us?size=250x83&releaseDate=1613433600&h=e646326660e49c679799ea2c2cf963c8" alt="Download on the App Store" style="border-radius: 13px; width: 250px; height: 83px;"></a>
</p>
<form method="post" action="/MMM-Powerwall/auth" novalidate>
{% for field in ["username", "token", "refresh_token" ] %}
<div class="form-field {{ "form-field-invalid" if errors[field] else '' }}">
<label for="{{field}}">{{ translations[field] }}</label>
{% if field == "username" %}
<select name="{{field}}">
{% for username in configUsers -%}
<option value="{{username}}">{{username}}</option>
{%- endfor %}
</select>
{% else %}
<input class="input" id="{{field}}" name="{{field}}" type="text" value="{{ data[field] }}">
{% endif %}
{%- if errors[field] %}
<div class="error">{{errors[field].msg}}</div>
{% endif %}
</div>
{% endfor %}
<div class="form-actions">
<button class="btn" type="submit">{{ translations.fetch }}</button>
</div>
</form>
<div class="form-header">
<h2>{{ translations.powerwallHeader }}</h2>
<ul class="errors-list">
{% for error in pwErrors %}
<li>{{ error.msg }}</li>
{% endfor %}
</ul>
</div>
<form method="post" action="/MMM-Powerwall/authLocal" novalidate>
{% for field in ["ip", "password" ] %}
<div class="form-field {{ "form-field-invalid" if errors[field] else '' }}">
<label for="{{field}}">{{ translations[field] }}</label>
{% if field == "ip" %}
<select name="{{field}}">
{% for ip in configIPs -%}
<option value="{{ip}}">{{ip}}</option>
{%- endfor %}
</select>
{% else %}
<input class="input" id="{{field}}" name="{{field}}" type="
{{- "password" if field == "password" else "text" -}}
" maxlength="
{{- 6 if field == "mfa" else 30 -}}
" value="{{ data[field] }}">
{% endif %}
{% if errors[field] %}
<div class="error">{{errors[field].msg}}</div>
{% endif %}
</div>
{% endfor %}
<div class="form-actions">
<button class="btn" type="submit">{{ translations.fetch }}</button>
</div>
</form>
</body>
</html>