mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
chore: guess user timezone on signup
This commit is contained in:
parent
c142b525a4
commit
04690d287d
@ -39,6 +39,7 @@ type Signup struct {
|
||||
Email string `schema:"email"`
|
||||
Password string `schema:"password"`
|
||||
PasswordRepeat string `schema:"password_repeat"`
|
||||
Location string `schema:"location"`
|
||||
}
|
||||
|
||||
type SetPasswordRequest struct {
|
||||
|
@ -76,8 +76,9 @@ func (srv *UserService) Count() (int64, error) {
|
||||
func (srv *UserService) CreateOrGet(signup *models.Signup, isAdmin bool) (*models.User, bool, error) {
|
||||
u := &models.User{
|
||||
ID: signup.Username,
|
||||
Email: signup.Email,
|
||||
ApiKey: uuid.NewV4().String(),
|
||||
Email: signup.Email,
|
||||
Location: signup.Location,
|
||||
Password: signup.Password,
|
||||
IsAdmin: isAdmin,
|
||||
}
|
||||
|
@ -34,6 +34,8 @@
|
||||
</div>
|
||||
|
||||
<form class="mt-10" action="signup" method="post">
|
||||
<input type="hidden" name="location" id="input-location">
|
||||
|
||||
<div class="mb-8">
|
||||
<label class="inline-block text-sm mb-1 text-gray-500" for="username">Username</label>
|
||||
<input class="shadow appearance-none bg-gray-800 focus:bg-gray-700 text-gray-300 border-green-700 focus:border-gray-500 border rounded w-full py-1 px-3"
|
||||
@ -78,6 +80,14 @@
|
||||
{{ template "footer.tpl.html" . }}
|
||||
|
||||
{{ template "foot.tpl.html" . }}
|
||||
|
||||
<script type="text/javascript">
|
||||
function guessTimezone() {
|
||||
return Intl.DateTimeFormat().resolvedOptions().timeZone
|
||||
}
|
||||
|
||||
document.getElementById('input-location').setAttribute('value', guessTimezone())
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user