master
E. Almqvist 3 years ago
parent 8bd577f663
commit d363aa9e77
  1. 24
      src/db_models.rb
  2. 1
      src/misc/subtitles.txt
  3. 21
      src/views/layout.slim
  4. 19
      src/views/stylesheets/style.sass
  5. 6
      src/views/user/login.slim

@ -31,27 +31,17 @@ class User < Table
check_pass_len = password.length >= MIN_PASSWORD_LEN
# This code is really ugly
# TODO: refactor
if not check_all_fields then
return false, REGISTER_ERRORS[:fields]
elsif not check_email_dupe then
return false, REGISTER_ERRORS[:email_dupe]
elsif not check_email_valid then
return false, REGISTER_ERRORS[:email_fake]
elsif not check_name_len then
return false, REGISTER_ERRORS[:name_len]
elsif not check_pass_equals then
return false, REGISTER_ERRORS[:pass_notequals]
elsif not check_pass_len then
return false, REGISTER_ERRORS[:pass_len]
else
return true, ""
end
return false, REGISTER_ERRORS[:fields] unless check_all_fields
return false, REGISTER_ERRORS[:email_dupe] unless check_email_dupe
return false, REGISTER_ERRORS[:email_fake] unless check_email_valid
return false, REGISTER_ERRORS[:name_len] unless check_name_len
return false, REGISTER_ERRORS[:pass_notequals] unless check_pass_equals
return false, REGISTER_ERRORS[:pass_len] unless check_pass_len
return true, ""
end
# Register a new user
# Returns: success?, data
# TODO: input checks & ERRORS!
def register(email, name, password, password_confirm)
check, errorstr = self.validate_credentials(email, name, password, password_confirm)

@ -1,7 +1,6 @@
V2FpdCwgbW9uZXkgaGFzIG5vIHZhbHVlPyEK
No such place like 127.0.0.1!
Fourty-two? What do you mean? Tell me!
What sort of executable format do you intend to support for apps running under your OS?
I would just like to interject for a moment...
68747470733a2f2f777963682e6465762f6369706865722e747874
CSRF? No, I do not think so.

@ -12,10 +12,17 @@ html lang="en"
h2 = get_random_subtitle
nav
ul
li
a.button#register href="/register" target="_self"
| Register
li
a.button#login href="/login" target="_self"
| Log in
==yield
- unless session[:auth_token]
li
a.button#register href="/register" target="_self"
| Register
li
a.button#login href="/login" target="_self"
| Log in
- else
li
a.button#profile href="/profile" target="_self"
| Profile
.content-container
==yield

@ -22,14 +22,22 @@ $special_btn_clr: #4776C1
html
background-color: $bg_clr
.content-container
display: flex
flex-direction: column
justify-content: center
width: auto
height: 90%
body
margin: 0
height: 100%
header
background-color: $bg_alt_clr
border-bottom: 1px solid $shadow_clr
background-color: $bg_clr
// border-bottom: 1px solid $shadow_clr
padding: .1rem .8rem .4rem .8rem
margin-bottom: 1rem
white-space: nowrap
div
display: flex
@ -52,7 +60,7 @@ body
h2
padding-left: 6px
margin: 0
opacity: .5
opacity: .2
font-size: .8rem
font-style: italic
font-weight: normal
@ -101,10 +109,11 @@ label.error_msg
form
display: flex
flex-direction: column
justify-content: center
padding: 2rem
margin: 0
width: 60%
max-width: 600px
max-width: 400px
border-radius: .4rem
a

@ -1,10 +1,10 @@
.form-container
form action="/user/login" method="post"
h2 Log in
label.error_msg = info
h2 Log in
label.error_msg = info[:error_msg]
input type="text" name="email" placeholder="Email"
input type="password" name="password" placeholder="Password"
input type="submit" value="Log in"
a.button href="/register" target="_self"
| Don't have an account?
| Don't have an account? Create one!

Loading…
Cancel
Save