locomotivecms_steam 1.2.1 → 1.3.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/Gemfile +3 -2
  4. data/Gemfile.lock +57 -50
  5. data/LICENSE +1 -1
  6. data/README.md +1 -1
  7. data/config/locales/nl.yml +2 -2
  8. data/lib/locomotive/steam/adapters/filesystem/yaml_loaders/content_entry.rb +8 -0
  9. data/lib/locomotive/steam/adapters/memory/condition.rb +1 -1
  10. data/lib/locomotive/steam/configuration.rb +1 -1
  11. data/lib/locomotive/steam/decorators/template_decorator.rb +1 -1
  12. data/lib/locomotive/steam/entities/content_entry.rb +17 -0
  13. data/lib/locomotive/steam/entities/content_type.rb +1 -0
  14. data/lib/locomotive/steam/entities/content_type_field.rb +1 -0
  15. data/lib/locomotive/steam/entities/editable_element.rb +4 -0
  16. data/lib/locomotive/steam/errors.rb +35 -5
  17. data/lib/locomotive/steam/initializers/sprockets.rb +6 -80
  18. data/lib/locomotive/steam/liquid/drops/page.rb +9 -2
  19. data/lib/locomotive/steam/liquid/filters/date.rb +109 -0
  20. data/lib/locomotive/steam/liquid/tags/action.rb +6 -1
  21. data/lib/locomotive/steam/liquid/tags/authorize.rb +65 -0
  22. data/lib/locomotive/steam/liquid/tags/snippet.rb +10 -2
  23. data/lib/locomotive/steam/liquid/template.rb +3 -1
  24. data/lib/locomotive/steam/middlewares/auth.rb +187 -0
  25. data/lib/locomotive/steam/middlewares/redirection.rb +24 -0
  26. data/lib/locomotive/steam/middlewares/renderer.rb +20 -3
  27. data/lib/locomotive/steam/middlewares/sitemap.rb +3 -1
  28. data/lib/locomotive/steam/middlewares/templatized_page.rb +1 -6
  29. data/lib/locomotive/steam/middlewares/thread_safe.rb +19 -0
  30. data/lib/locomotive/steam/middlewares/url_redirection.rb +14 -1
  31. data/lib/locomotive/steam/repositories.rb +5 -1
  32. data/lib/locomotive/steam/repositories/content_entry_repository.rb +1 -1
  33. data/lib/locomotive/steam/repositories/content_type_field_repository.rb +4 -0
  34. data/lib/locomotive/steam/server.rb +2 -0
  35. data/lib/locomotive/steam/services.rb +9 -1
  36. data/lib/locomotive/steam/services/action_service.rb +26 -7
  37. data/lib/locomotive/steam/services/asset_host_service.rb +6 -1
  38. data/lib/locomotive/steam/services/auth_service.rb +105 -0
  39. data/lib/locomotive/steam/services/content_entry_service.rb +14 -0
  40. data/lib/locomotive/steam/services/external_api_service.rb +59 -25
  41. data/lib/locomotive/steam/services/liquid_parser_service.rb +5 -1
  42. data/lib/locomotive/steam/services/page_redirection_service.rb +29 -0
  43. data/lib/locomotive/steam/version.rb +1 -1
  44. data/locomotivecms_steam.gemspec +18 -16
  45. data/spec/fixtures/default/app/content_types/accounts.yml +59 -0
  46. data/spec/fixtures/default/app/content_types/songs.yml +2 -1
  47. data/spec/fixtures/default/app/views/pages/about_us/john_doe.fr.liquid.haml +5 -1
  48. data/spec/fixtures/default/app/views/pages/about_us/john_doe.liquid.haml +1 -1
  49. data/spec/fixtures/default/app/views/pages/account/forgot_password.liquid +39 -0
  50. data/spec/fixtures/default/app/views/pages/account/me.liquid +15 -0
  51. data/spec/fixtures/default/app/views/pages/account/reset_password.liquid +42 -0
  52. data/spec/fixtures/default/app/views/pages/account/sign_in.liquid +49 -0
  53. data/spec/fixtures/default/app/views/pages/all.liquid.haml +1 -1
  54. data/spec/fixtures/default/app/views/pages/emails/reset_password.liquid +15 -0
  55. data/spec/fixtures/default/app/views/pages/songs/template.liquid.haml +1 -1
  56. data/spec/fixtures/default/config/metafields_schema.yml +10 -0
  57. data/spec/fixtures/default/config/site.yml +5 -0
  58. data/spec/fixtures/default/config/translations.yml +25 -1
  59. data/spec/fixtures/default/data/accounts.yml +15 -0
  60. data/spec/fixtures/mongodb/locomotive_accounts.bson +0 -0
  61. data/spec/fixtures/mongodb/locomotive_accounts.metadata.json +1 -1
  62. data/spec/fixtures/mongodb/locomotive_activities.bson +0 -0
  63. data/spec/fixtures/mongodb/locomotive_activities.metadata.json +1 -1
  64. data/spec/fixtures/mongodb/locomotive_content_assets.bson +0 -0
  65. data/spec/fixtures/mongodb/locomotive_content_assets.metadata.json +1 -1
  66. data/spec/fixtures/mongodb/locomotive_content_entries.bson +0 -0
  67. data/spec/fixtures/mongodb/locomotive_content_entries.metadata.json +1 -1
  68. data/spec/fixtures/mongodb/locomotive_content_types.bson +0 -0
  69. data/spec/fixtures/mongodb/locomotive_content_types.metadata.json +1 -1
  70. data/spec/fixtures/mongodb/locomotive_pages.bson +0 -0
  71. data/spec/fixtures/mongodb/locomotive_pages.metadata.json +1 -1
  72. data/spec/fixtures/mongodb/locomotive_sites.bson +0 -0
  73. data/spec/fixtures/mongodb/locomotive_sites.metadata.json +1 -1
  74. data/spec/fixtures/mongodb/locomotive_snippets.bson +0 -0
  75. data/spec/fixtures/mongodb/locomotive_snippets.metadata.json +1 -1
  76. data/spec/fixtures/mongodb/locomotive_theme_assets.bson +0 -0
  77. data/spec/fixtures/mongodb/locomotive_theme_assets.metadata.json +1 -1
  78. data/spec/fixtures/mongodb/locomotive_translations.bson +0 -0
  79. data/spec/fixtures/mongodb/locomotive_translations.metadata.json +1 -1
  80. data/spec/integration/repositories/content_entry_repository_spec.rb +1 -1
  81. data/spec/integration/repositories/content_type_repository_spec.rb +1 -1
  82. data/spec/integration/repositories/page_repository_spec.rb +3 -3
  83. data/spec/integration/repositories/theme_asset_repository_spec.rb +1 -1
  84. data/spec/integration/repositories/translation_repository_spec.rb +1 -1
  85. data/spec/integration/server/auth_spec.rb +196 -0
  86. data/spec/integration/server/basic_spec.rb +18 -0
  87. data/spec/integration/server/nav_spec.rb +1 -1
  88. data/spec/integration/server/sitemap_spec.rb +1 -1
  89. data/spec/integration/services/content_entry_service_spec.rb +1 -1
  90. data/spec/integration/services/external_api_service_spec.rb +9 -0
  91. data/spec/support/helpers.rb +1 -1
  92. data/spec/unit/adapters/filesystem/yaml_loaders/content_entry_spec.rb +17 -5
  93. data/spec/unit/adapters/filesystem/yaml_loaders/content_type_spec.rb +4 -4
  94. data/spec/unit/adapters/filesystem/yaml_loaders/page_spec.rb +7 -7
  95. data/spec/unit/adapters/filesystem/yaml_loaders/site_spec.rb +1 -1
  96. data/spec/unit/adapters/filesystem/yaml_loaders/translation_spec.rb +1 -1
  97. data/spec/unit/entities/content_entry_spec.rb +10 -0
  98. data/spec/unit/errors_spec.rb +2 -2
  99. data/spec/unit/initializers/sprockets_spec.rb +0 -14
  100. data/spec/unit/liquid/drops/page_spec.rb +3 -2
  101. data/spec/unit/liquid/filters/date_spec.rb +219 -0
  102. data/spec/unit/liquid/tags/action_spec.rb +9 -0
  103. data/spec/unit/liquid/tags/authorize_spec.rb +51 -0
  104. data/spec/unit/liquid/tags/link_to_spec.rb +1 -1
  105. data/spec/unit/liquid/tags/paginate_spec.rb +1 -1
  106. data/spec/unit/liquid/tags/snippet_spec.rb +10 -0
  107. data/spec/unit/middlewares/auth_spec.rb +31 -0
  108. data/spec/unit/middlewares/redirection_spec.rb +37 -0
  109. data/spec/unit/middlewares/url_redirection_spec.rb +20 -1
  110. data/spec/unit/services/action_service_spec.rb +57 -1
  111. data/spec/unit/services/asset_host_service_spec.rb +15 -0
  112. data/spec/unit/services/auth_service_spec.rb +156 -0
  113. data/spec/unit/services/external_api_service_spec.rb +22 -0
  114. data/spec/unit/services/page_redirection_service_spec.rb +49 -0
  115. metadata +96 -40
  116. data/CHANGELOG.md +0 -29
  117. data/spec/fixtures/mongodb/system.indexes.bson +0 -0
@@ -56,6 +56,20 @@ module Locomotive
56
56
  end
57
57
  end
58
58
 
59
+ def update_decorated_entry(decorated_entry, attributes)
60
+ with_repository(decorated_entry.content_type) do |_repository|
61
+ entry = decorated_entry.__getobj__
62
+
63
+ entry.change(clean_attributes(attributes))
64
+
65
+ _repository.update(entry)
66
+
67
+ logEntryOperation(decorated_entry.content_type.slug, decorated_entry)
68
+
69
+ decorated_entry
70
+ end
71
+ end
72
+
59
73
  def delete(type_slug, id_or_slug)
60
74
  with_repository(type_slug) do |_repository|
61
75
  entry = _repository.by_slug(id_or_slug) || _repository.find(id_or_slug)
@@ -7,23 +7,55 @@ module Locomotive
7
7
 
8
8
  include ::HTTParty
9
9
 
10
- def consume(url, options = {})
11
- options[:base_uri], path = extract_base_uri_and_path(url)
10
+ # Available option keys:
11
+ # - method
12
+ # - data
13
+ # - format
14
+ # - username / password (basic auth)
15
+ # - headers
16
+ # - header_auth
17
+ # - with_user_agent
18
+ #
19
+ def consume(url, options = {}, with_status = false)
20
+ base_uri, path = extract_base_uri_and_path(url)
21
+
22
+ method = (options[:method] || 'GET').to_s.downcase
23
+
24
+ _options = build_httpparty_options(options, method)
25
+ _options[:base_uri] = base_uri
26
+
27
+ if with_status
28
+ verbose_perform_request_to(method, path, _options)
29
+ else
30
+ perform_request_to(method, path, _options)
31
+ end
32
+ end
33
+
34
+ private
12
35
 
13
- options.delete(:format) if options[:format] == 'default'
36
+ def build_httpparty_options(options, method)
37
+ _options = {}
14
38
 
15
- # auth ?
16
- username, password = options.delete(:username), options.delete(:password)
17
- options[:basic_auth] = { username: username, password: password } if username
39
+ # data: body (POST/PUT/PATCH) or query (GET)
40
+ _options[method == 'get' ? :query : :body] = options[:data] if options[:data]
18
41
 
19
- # authorization header ?
20
- header_auth = options.delete(:header_auth)
21
- options[:headers] = { 'Authorization' => header_auth } if header_auth
42
+ # basic auth?
43
+ username, password = options[:username], options[:password]
44
+ _options[:basic_auth] = { username: username, password: password } if username
22
45
 
23
- perform_request_to(path, options)
24
- end
46
+ # headers
47
+ _options[:headers] = options[:headers] || {}
48
+ _options[:headers]['Authorization'] = options[:header_auth] if options[:header_auth]
49
+ _options[:headers]['User-Agent'] = 'LocomotiveCMS' if options[:with_user_agent]
50
+ _options.delete(:headers) if _options[:headers].blank?
25
51
 
26
- private
52
+ # format
53
+ if options.has_key?(:format) && options[:format] != 'default'
54
+ _options[:format] = options[:format].gsub(/[\'\"]/, '').to_sym
55
+ end
56
+
57
+ _options
58
+ end
27
59
 
28
60
  def extract_base_uri_and_path(url)
29
61
  url = HTTParty.normalize_base_uri(url)
@@ -31,32 +63,34 @@ module Locomotive
31
63
  uri = URI.parse(url)
32
64
  path = uri.request_uri || '/'
33
65
  base_uri = "#{uri.scheme}://#{uri.host}"
34
- base_uri += ":#{uri.port}" if uri.port != 80
66
+ base_uri += ":#{uri.port}" if (uri.port != 80 && uri.port != 443)
35
67
 
36
68
  [base_uri, path]
37
69
  end
38
70
 
39
- def perform_request_to(path, options)
40
- # [DEBUG] puts "[WebService] consuming #{path}, #{options.inspect}"
41
-
42
- # sanitize the options
43
- options[:format] = options[:format].gsub(/[\'\"]/, '').to_sym if options.has_key?(:format)
44
- if options[:with_user_agent]
45
- user_agent = { 'User-Agent' => 'LocomotiveCMS' }
46
- options[:headers] ? options[:headers].merge!(user_agent) : options[:headers] = user_agent
47
- end
48
-
49
- response = self.class.get(path, options)
71
+ def perform_request_to(method, path, options)
72
+ response = self.class.send(method.to_sym, path, options)
50
73
  parsed_response = response.parsed_response
51
74
 
52
75
  if response.code == 200
53
76
  HashConverter.to_underscore(parsed_response)
54
77
  else
55
- Locomotive::Common::Logger.error "[WebService] consumed #{path}, #{options.inspect}, response = #{response.inspect}"
78
+ Locomotive::Common::Logger.error "[WebService] consumed [#{method.to_s.upcase}] #{path}, #{options.inspect}, response = #{response.inspect}"
56
79
  nil
57
80
  end
58
81
  end
59
82
 
83
+ def verbose_perform_request_to(method, path, options)
84
+ response = self.class.send(method.to_sym, path, options)
85
+ parsed_response = response.parsed_response
86
+ {
87
+ status: response.code,
88
+ data: HashConverter.to_underscore(parsed_response)
89
+ }
90
+ rescue Exception => e
91
+ { status: nil, error: e.message }
92
+ end
93
+
60
94
  end
61
95
  end
62
96
  end
@@ -22,7 +22,11 @@ module Locomotive
22
22
 
23
23
  def _parse(object, options = {})
24
24
  # Note: the template must not be parsed here
25
- Locomotive::Steam::Liquid::Template.parse(object.liquid_source, options)
25
+ begin
26
+ Locomotive::Steam::Liquid::Template.parse(object.liquid_source, options)
27
+ rescue ::Liquid::Error => e
28
+ raise Locomotive::Steam::RenderError.new(e, object.template_path, object.liquid_source)
29
+ end
26
30
  end
27
31
 
28
32
  end
@@ -0,0 +1,29 @@
1
+ module Locomotive
2
+ module Steam
3
+
4
+ class PageRedirectionService
5
+
6
+ attr_accessor_initialize :page_finder, :url_builder
7
+
8
+ def redirect_to(handle, locale = nil)
9
+ if page_url = url_to(handle, locale)
10
+ raise Locomotive::Steam::RedirectionException.new(page_url)
11
+ else
12
+ false
13
+ end
14
+ end
15
+
16
+ private
17
+
18
+ def url_to(handle, locale)
19
+ if page = page_finder.by_handle(handle)
20
+ url = url_builder.url_for(page, locale)
21
+ else
22
+ false
23
+ end
24
+ end
25
+
26
+ end
27
+
28
+ end
29
+ end
@@ -3,6 +3,6 @@
3
3
  # 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0
4
4
  module Locomotive
5
5
  module Steam
6
- VERSION = '1.2.1'
6
+ VERSION = '1.3.0.rc1'
7
7
  end
8
8
  end
@@ -18,32 +18,34 @@ Gem::Specification.new do |spec|
18
18
  spec.add_development_dependency 'bundler', '~> 1.7'
19
19
  spec.add_development_dependency 'rake', '~> 10.4.2'
20
20
 
21
- spec.add_development_dependency 'mongo', '~> 2.2.7'
22
- spec.add_development_dependency 'origin', '~> 2.2.0'
21
+ spec.add_development_dependency 'mongo', '~> 2.4.1'
22
+ spec.add_development_dependency 'origin', '~> 2.3.0'
23
23
 
24
- spec.add_dependency 'nokogiri', '~> 1.6.8'
25
- spec.add_dependency 'sanitize', '~> 4.0.1'
24
+ spec.add_dependency 'nokogiri', '~> 1.7.0.1'
25
+ spec.add_dependency 'sanitize', '~> 4.4.0'
26
26
  spec.add_dependency 'morphine', '~> 0.1.1'
27
- spec.add_dependency 'httparty', '~> 0.13.6'
27
+ spec.add_dependency 'httparty', '~> 0.14.0'
28
28
  spec.add_dependency 'chronic', '~> 0.10.2'
29
+ spec.add_dependency 'bcrypt', '~> 3.1.11'
29
30
 
30
31
  spec.add_dependency 'rack-rewrite', '~> 1.5.1'
31
- spec.add_dependency 'rack-cache', '~> 1.6.1'
32
- spec.add_dependency 'dragonfly', '~> 1.0.12'
33
- spec.add_dependency 'moneta', '~> 0.8.0'
34
- spec.add_dependency 'rack_csrf', '~> 2.5.0'
35
-
36
- spec.add_dependency 'sprockets', '~> 3.5.2'
37
- spec.add_dependency 'sass', '~> 3.4.21'
32
+ spec.add_dependency 'rack-cache', '~> 1.7.0'
33
+ spec.add_dependency 'rack_csrf', '~> 2.6.0'
34
+ spec.add_dependency 'dragonfly', '~> 1.1.1'
35
+ spec.add_dependency 'moneta', '~> 1.0.0'
36
+
37
+ spec.add_dependency 'sprockets', '~> 3.7.1'
38
+ spec.add_dependency 'sass', '~> 3.4.23'
39
+ spec.add_dependency 'uglifier', '~> 3.1.6'
38
40
  spec.add_dependency 'coffee-script', '~> 2.4.1'
39
41
  spec.add_dependency 'compass', '~> 1.0.3'
40
- spec.add_dependency 'autoprefixer-rails', '~> 6.3.3.1'
42
+ spec.add_dependency 'autoprefixer-rails', '~> 6.7.2'
41
43
 
42
- spec.add_dependency 'kramdown', '~> 1.10.0'
44
+ spec.add_dependency 'kramdown', '~> 1.13.2'
43
45
  spec.add_dependency 'RedCloth', '~> 4.3.2'
44
46
  spec.add_dependency 'mimetype-fu', '~> 0.1.2'
45
- spec.add_dependency 'mime-types', '~> 2.6.1'
46
- spec.add_dependency 'duktape', '~> 1.3.0.6'
47
+ spec.add_dependency 'mime-types', '~> 3.1.0'
48
+ spec.add_dependency 'duktape', '~> 1.6.1.0'
47
49
  spec.add_dependency 'pony', '~> 1.11'
48
50
 
49
51
  spec.add_dependency 'locomotivecms-solid', '~> 4.0.1'
@@ -0,0 +1,59 @@
1
+ # Human readable name of this type
2
+ name: Accounts
3
+
4
+ # Lowercase, underscored handle used to access this type
5
+ slug: accounts
6
+
7
+ # Explanatory text displayed in the back-office
8
+ description: A description of the content type for the editors
9
+
10
+ # Slug of field used to identify entries by default, such as the title
11
+ label_field_name: name
12
+
13
+ # Valid values: manually, created_at, updated_at, or the slug of any field
14
+ order_by: manually
15
+
16
+ # Valid values: asc (ascending) and desc (descending). Set to asc by default.
17
+ # order_direction: asc
18
+
19
+ # Specify a field slug to group entries by that field in the back-office.
20
+ # group_by: <your field>
21
+
22
+ # Activate public 'create' API (e.g for a contact form)
23
+ # public_submission_enabled: false
24
+
25
+ # Array of emails to be notified of new entries made with the public API
26
+ # public_submission_accounts: ['john@example.com']
27
+
28
+ # Control the display of the content type in the back-office.
29
+ # display_settings:
30
+ # seo: false # display the SEO tab for the content entries
31
+ # advanced: false # display the Advanced tab for the content entries
32
+ # position: 1 # position in the sidebar menu
33
+ # hidden: false # hidden for authors?
34
+
35
+ # By default, the back-office displays the _label property (see label_field_name) of the content entry. This can be modified by writing your own Liquid template below:
36
+ # entry_template: '<a href="{{ link }}">{{ entry._label }}</a>' # The default template
37
+
38
+ # A list describing each field
39
+ fields:
40
+ - name: # The lowercase, underscored name of the field
41
+ label: Name # Human readable name of the field
42
+ type: string
43
+ required: true
44
+ hint: Explanatory text displayed in the back office
45
+ localized: false
46
+
47
+ - email: # The lowercase, underscored name of the field
48
+ label: Email # Human readable name of the field
49
+ type: email
50
+ required: false
51
+ hint: Explanatory text displayed in the back office
52
+ localized: false
53
+
54
+ - password: # The lowercase, underscored name of the field
55
+ label: Password # Human readable name of the field
56
+ type: password
57
+ required: false
58
+ hint: Explanatory text displayed in the back office
59
+ localized: false
@@ -15,6 +15,7 @@ fields:
15
15
  label: Cover
16
16
  type: file
17
17
  required: true
18
+ # localized: true # required when pushing the site with Wagon
18
19
  - short_description:
19
20
  type: text
20
21
  text_formatting: html
@@ -22,4 +23,4 @@ fields:
22
23
  type: string
23
24
  hint: Url to a service like Blip for instance
24
25
  - duration:
25
- hint: "format like: mm:ss"
26
+ hint: "format like: mm:ss"
@@ -2,4 +2,8 @@
2
2
  title: Jean Personne
3
3
  slug: jean-personne
4
4
  ---
5
- {% extends parent %}
5
+ {% action "fake action" %}
6
+
7
+ foo(32);
8
+
9
+ {% endaction %}
@@ -3,4 +3,4 @@ position: 1
3
3
  published: true
4
4
  listed: true
5
5
  ---
6
- {% extends parent %}
6
+ {% for %} <!-- Liquid syntax error -->
@@ -0,0 +1,39 @@
1
+ ---
2
+ title: Forgot password
3
+ published: true
4
+ listed: false
5
+ handle: forgot_password
6
+ ---
7
+ {% extends 'index' %}
8
+
9
+ {% block content %}
10
+
11
+ <h1>Forgot your password</h1>
12
+
13
+ {% if current_account %}
14
+ <div class="alert alert-warning">
15
+ You're already authenticated!
16
+ </div>
17
+ {% else %}
18
+ {% if auth_reset_password_instructions_sent %}
19
+ {{ auth_reset_password_instructions_sent | translate }}
20
+ {% else %}
21
+ <form action="{% path_to 'forgot_password' %}" method="POST">
22
+ <input type="hidden" name="auth_action" value="forgot_password" />
23
+ <input type="hidden" name="auth_content_type" value="accounts" />
24
+ <input type="hidden" name="auth_id_field" value="email" />
25
+ <input type="hidden" name="auth_callback" value="{% path_to sign_in %}" />
26
+
27
+ {% if auth_wrong_email %}
28
+ {{ auth_wrong_email | translate }}
29
+ {% endif %}
30
+
31
+ <label for="auth-email">Your E-mail</label>
32
+ <input type="email" id="auth-email" placeholder="Email" name="auth_id" value="{{ params.auth_id }}">
33
+
34
+ <button type="submit" class="btn btn-default">Submit</button>
35
+ </form>
36
+ {% endif %}
37
+ {% endif %}
38
+
39
+ {% endblock %}
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: Account profile
3
+ listed: false
4
+ published: true
5
+ handle: me
6
+ ---
7
+ {% extends 'index' %}
8
+
9
+ {% block content %}
10
+
11
+ {% if current_account %}
12
+ <p>My name is {{ current_account.name }} and I'm logged in!</p>
13
+ {% endif %}
14
+
15
+ {% endblock %}
@@ -0,0 +1,42 @@
1
+ ---
2
+ title: Change your password
3
+ published: true
4
+ listed: false
5
+ handle: reset_password
6
+ ---
7
+ {% extends 'index' %}
8
+
9
+ {% block content %}
10
+
11
+ <h2>Change your password</h2>
12
+
13
+ {% if current_account %}
14
+ You're already authenticated!
15
+ {% else %}
16
+ <form action="{% path_to 'reset_password' %}" method="POST">
17
+ <input type="hidden" name="auth_action" value="reset_password" />
18
+ <input type="hidden" name="auth_content_type" value="accounts" />
19
+ <input type="hidden" name="auth_password_field" value="email" />
20
+ <input type="hidden" name="auth_reset_token" value="{{ params.token }}" />
21
+ <input type="hidden" name="auth_callback" value="{% path_to me %}" />
22
+
23
+ {% if auth_invalid_token %}
24
+ {{ auth_invalid_token | translate }}
25
+ {% endif %}
26
+
27
+ {% if auth_password_too_short %}
28
+ {{ auth_password_too_short | translate }}
29
+ {% endif %}
30
+
31
+ <div class="form-group">
32
+ <label for="auth-password">Your new password</label>
33
+ <input type="password" class="form-control" id="auth-password" placeholder="Password" name="auth_password">
34
+ </div>
35
+
36
+ <button type="submit" class="btn btn-default">Submit</button>
37
+ </form>
38
+
39
+ {% endif %}
40
+ </div>
41
+
42
+ {% endblock %}
@@ -0,0 +1,49 @@
1
+ ---
2
+ title: Sign in
3
+ listed: false
4
+ published: true
5
+ handle: sign_in
6
+ ---
7
+ {% extends 'index' %}
8
+
9
+ {% block content %}
10
+
11
+ <h1>Sign in</h1>
12
+
13
+ {% if current_account %}
14
+ <div class="alert alert-warning">
15
+ You're already authenticated!
16
+ </div>
17
+ {% else %}
18
+
19
+ <form action="{% path_to 'sign_in' %}" method="POST">
20
+ <input type="hidden" name="auth" value="sign_in" />
21
+ <input type="hidden" name="auth_content_type" value="accounts" />
22
+ <input type="hidden" name="auth_id_field" value="email" />
23
+ <input type="hidden" name="auth_password_field" value="password" />
24
+
25
+ {% if auth_signed_out %}
26
+ <div class="alert alert-info">
27
+ {{ auth_signed_out | translate }}
28
+ </div>
29
+ {% endif %}
30
+
31
+ {% if auth_wrong_credentials %}
32
+ <div class="alert alert-warning">
33
+ {{ auth_wrong_credentials | translate }}
34
+ </div>
35
+ {% endif %}
36
+
37
+ <div class="form-group">
38
+ <label for="auth-email">Your E-mail</label>
39
+ <input type="email" name="auth_id" class="form-control" id="auth-email" placeholder="Email">
40
+ </div>
41
+ <div class="form-group">
42
+ <label for="auth-password">Password</label>
43
+ <input type="password" name="auth_password" class="form-control" id="auth-password" placeholder="Password">
44
+ </div>
45
+ <button type="submit" class="btn btn-default">Sign in</button>
46
+ </form>
47
+ {% endif %}
48
+
49
+ {% endblock %}