Module: MinimalistAuthentication::ApplicationHelper

Defined in:
app/helpers/minimalist_authentication/application_helper.rb

Instance Method Summary collapse

Instance Method Details



5
6
7
# File 'app/helpers/minimalist_authentication/application_helper.rb', line 5

def ma_change_email_link
  link_to("Change", edit_email_path)
end

#ma_confirm_password_field(form, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/minimalist_authentication/application_helper.rb', line 9

def ma_confirm_password_field(form, options = {})
  form.password_field(
    :password_confirmation,
    options.reverse_merge(
      autocomplete: "new-password",
      minlength:    MinimalistAuthentication.user_model.password_minimum,
      placeholder:  true,
      required:     true
    )
  )
end

#ma_email_field(form, options = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'app/helpers/minimalist_authentication/application_helper.rb', line 21

def ma_email_field(form, options = {})
  form.email_field(
    :email,
    options.reverse_merge(
      autocomplete: "email",
      autofocus:    true,
      placeholder:  t(".email.placeholder", default: true),
      required:     true
    )
  )
end

#ma_email_verification_buttonObject



33
34
35
# File 'app/helpers/minimalist_authentication/application_helper.rb', line 33

def ma_email_verification_button(**)
  button_to(t(".button"), email_verification_path, **)
end


37
38
39
# File 'app/helpers/minimalist_authentication/application_helper.rb', line 37

def ma_forgot_password_link
  link_to(t(".forgot_password"), new_password_reset_path)
end

#ma_new_password_field(form, options = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
# File 'app/helpers/minimalist_authentication/application_helper.rb', line 41

def ma_new_password_field(form, options = {})
  form.password_field(
    :password,
    options.reverse_merge(
      autocomplete: "new-password",
      minlength:    MinimalistAuthentication.user_model.password_minimum,
      placeholder:  "New password",
      required:     true
    )
  )
end

#ma_password_field(form, options = {}) ⇒ Object



53
54
55
56
57
58
59
60
61
62
# File 'app/helpers/minimalist_authentication/application_helper.rb', line 53

def ma_password_field(form, options = {})
  form.password_field(
    :password,
    options.reverse_merge(
      autocomplete: "current-password",
      placeholder:  true,
      required:     true
    )
  )
end


64
65
66
# File 'app/helpers/minimalist_authentication/application_helper.rb', line 64

def ma_skip_link
  link_to("Skip", )
end

#ma_username_field(form, options = {}) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
# File 'app/helpers/minimalist_authentication/application_helper.rb', line 68

def ma_username_field(form, options = {})
  form.text_field(
    :username,
    options.reverse_merge(
      autocomplete: "username",
      autofocus:    true,
      placeholder:  true,
      required:     true
    )
  )
end

#ma_verification_message(user = current_user) ⇒ Object



80
81
82
# File 'app/helpers/minimalist_authentication/application_helper.rb', line 80

def ma_verification_message(user = current_user)
  render(user.email_verified? ? "verified" : "unverified")
end