atome 0.5.6.2.4 → 0.5.6.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,280 @@
1
+ # frozen_string_literal: true
2
+ text(:hello)
3
+ class Atome
4
+
5
+ def build_tool(&bloc)
6
+ # alert params[:tool]
7
+ a = Atome.instance_exec(&bloc)
8
+ puts "===> a is : #{a[:action]}"
9
+ # check below
10
+ wait 2 do
11
+ send a[:action]
12
+ end
13
+ grab(:toolbox).box({color: :white, width: 33, height: 33})
14
+ end
15
+ end
16
+
17
+ class Object
18
+ def new(params, &bloc)
19
+ # Genesis = Genesis.Genesis
20
+ if params.key?(:atome)
21
+ Universe.add_atomes_specificities params[:atome]
22
+ Genesis.build_atome(params[:atome], &bloc)
23
+ elsif params.key?(:particle)
24
+ Atome.instance_variable_set("@main_#{params[:particle]}", bloc)
25
+ # render indicate if the particle needs to be rendered
26
+ # store tell the system if it need to store the particle value
27
+ # type help the system what type of type the particle will receive and store
28
+ Genesis.build_particle(params[:particle], { render: params[:render], return: params[:return],
29
+ store: params[:store], type: params[:type] }, &bloc)
30
+ elsif params.key?(:sanitizer)
31
+ Genesis.build_sanitizer(params[:sanitizer], &bloc)
32
+ elsif params.key?(:pre)
33
+ Atome.instance_variable_set("@pre_#{params[:pre]}", bloc)
34
+ elsif params.key?(:post)
35
+ Atome.instance_variable_set("@post_#{params[:post]}", bloc)
36
+ elsif params.key?(:after)
37
+ Atome.instance_variable_set("@after_#{params[:after]}", bloc)
38
+ elsif params.key?(:read)
39
+ Atome.instance_variable_set("@read_#{params[:read]}", bloc)
40
+ elsif params[:renderer]
41
+ renderer_found = params[:renderer]
42
+ if params[:specific]
43
+ Universe.set_atomes_specificities(params)
44
+ params[:specific] = "#{params[:specific]}_"
45
+ end
46
+ render_method = "#{renderer_found}_#{params[:specific]}#{params[:method]}"
47
+ Genesis.build_render(render_method, &bloc)
48
+ elsif params.key?(:callback)
49
+ particle_targetted = params[:callback]
50
+ Atome.define_method "#{particle_targetted}_callback" do
51
+ bloc.call
52
+ end
53
+ elsif params.key?(:tool)
54
+ A.build_tool(&bloc)
55
+ end
56
+ end
57
+ end
58
+
59
+ grab(:intuition).box({id: :toolbox, top: :auto, bottom: 0, left: 0, width: 50, height: 255})
60
+
61
+ def record_tool
62
+ grab(Universe.current_user).selection
63
+ alert "must get selection to treat it "
64
+ end
65
+
66
+
67
+ module Intuition
68
+ def intuition_int8
69
+ # tool taxonomy and list
70
+ {
71
+ capture: { int8: { french: :enregistrement, english: :record, german: :datensatz } },
72
+ communication: { french: :communication, english: :communication, german: :communication },
73
+ tool: { french: :outils, english: :tools, german: :werkzeuge },
74
+ view: { french: :vue, english: :view, german: :aussicht },
75
+ time: { french: :horloge, english: :clock, german: :Uhr },
76
+ find: { french: :trouve, english: :find, german: :finden },
77
+ home: { french: :accueil, english: :home, german: :zuhause },
78
+ code: { french: :code, english: :code, german: :code },
79
+ impulse: { french: :impulse, english: :impulse, german: :impulse },
80
+ }
81
+ end
82
+ def intuition_taxonomy
83
+
84
+ end
85
+
86
+ def impulse
87
+ # tool start point
88
+ [:capture, :communication, :tool, :view, :time, :find, :home]
89
+ end
90
+
91
+ # def capture
92
+ # categories=ATOME.methods_categories
93
+ # [categories[:inputs]]
94
+ # end
95
+ #
96
+ # def communication
97
+ # categories=ATOME.methods_categories
98
+ # [categories[:communications]]
99
+ # end
100
+ #
101
+ # def toolz
102
+ # categories=ATOME.methods_categories
103
+ # [categories[:spatials],categories[:helpers],categories[:materials],
104
+ # categories[:geometries],categories[:effects],
105
+ # categories[:medias],categories[:hierarchies],categories[:utilities],categories[:events]]
106
+ # end
107
+ #
108
+ # def tool_style(size = 33)
109
+ # # styling
110
+ # shadows = [{ x: size / 15, y: size / 15, thickness: 0, blur: size / 3, color: { red: 0, green: 0, blue: 0, alpha: 0.3 } }, { x: -size / 15, y: -size / 15, thickness: 0, blur: size / 6, color: { red: 1, green: 1, blue: 1, alpha: 0.3 } }]
111
+ # style = { type: :tool, content: { points: 4 }, color: { red: 0.9, green: 0.9, blue: 0.9, alpha: 0.15 }, parent: :intuition, shadow: shadows, blur: { value: 6, invert: true } }
112
+ # return style
113
+ # end
114
+ #
115
+ # def open_tool(tool_id, widthness=3, orientation=:x, speed=0.6)
116
+ # if orientation == :x
117
+ # orientation = :width
118
+ # value = grab(tool_id).width
119
+ # else
120
+ # orientation = :height
121
+ # value = grab(tool_id).height
122
+ # end
123
+ # animate({
124
+ # start: { orientation => value },
125
+ # end: { orientation => value * widthness },
126
+ # duration: speed * 1000,
127
+ # loop: 0,
128
+ # curve: :easing,
129
+ # target: tool_id
130
+ # })
131
+ # notification "find why this id #{self.atome_id}, add annimation callback to set overflow when anim complete"
132
+ # grab(tool_id).overflow(:visible)
133
+ # end
134
+ #
135
+ # def close_tool(tool_id, widthness, orientation, speed)
136
+ # if orientation == :x
137
+ # orientation = :width
138
+ # value = grab(tool_id).width
139
+ # else
140
+ # orientation = :height
141
+ # value = grab(tool_id).height
142
+ # end
143
+ # animate({
144
+ # start: { orientation => value * widthness },
145
+ # end: { orientation => value },
146
+ # duration: speed * 1000,
147
+ # loop: 0,
148
+ # curve: :easing,
149
+ # target: tool_id
150
+ # })
151
+ # # grab(tool_id).overflow(:hidden)
152
+ # end
153
+ #
154
+ # def create_tool(tool_name, size = 33, x_pos = 0, y_pos = 33, offsset=0)
155
+ # tool_created = tool(self.tool_style(size).merge({ parent: :main_menu, atome_id: "tool_" + tool_name, id: "tool_" + tool_name,
156
+ # width: size, height: size, smooth: size / 9, overflow: :hidden, x: x_pos, y: y_pos, z: 1, content: [] }))
157
+ # icon=tool_created.shape({ path: tool_name, width: size - size / 2, height: size - size / 2, center: true })
158
+ # # name = intuition_list[tool_name][language]
159
+ # particle({ atome_id: :tools_property_container, color: { red: 0.6, green: 0.6, blue: 0.6 } })
160
+ # # we get the plugin code only if the plugin hasn't been interpreted before (unless condition below)
161
+ # unless grab(:intuition).content.include? tool_name
162
+ # ATOME.reader("./medias/e_rubies/tools/#{tool_name}.rb") do |data|
163
+ # # todo add a security parser here
164
+ # # we set the variable tool that can be used to facilitate plugin creation
165
+ # data="tool=grab(:#{tool_created.atome_id})\n"+data
166
+ # compile(data)
167
+ # # we add the tool to the intuition content so it won't be loaded twice
168
+ # grab(:intuition).content |= [tool_name]
169
+ # end
170
+ # end
171
+ # # end
172
+ # tool_created.active({ exec: false })
173
+ # tool_created.inactive({ exec: false })
174
+ # icon.touch(stop: true) do
175
+ # if tool_created.active[:exec] == true
176
+ # tool_created.color(:transparent)
177
+ # tool_created.active(exec: false, proc: tool_created.active[:proc] )
178
+ # tool_created.inactive(exec: true, proc: tool_created.inactive[:proc] )
179
+ # else
180
+ # tool_created.color({alpha: 0.3})
181
+ # tool_created.active({ exec: true, proc: tool_created.active[:proc] })
182
+ # end
183
+ # end
184
+ # end
185
+ #
186
+ # # we get menu entry point
187
+ # def open_intuition(position = {})
188
+ # position = { x: 0, yy: 0, size: 33, orientation: :vertical, offset: 0 }.merge(position)
189
+ # # we get content language from view's language
190
+ # if grab(:main_menu)
191
+ # grab(:main_menu).delete
192
+ # else
193
+ # grab(:view).language
194
+ # self.language(grab(:view).language)
195
+ # orientation = position.delete(:orientation)
196
+ # size = position.delete(:size)
197
+ # offset = position.delete(:offset)
198
+ # # positioning and scaling
199
+ # if orientation == :vertical
200
+ # requested_width = size
201
+ # requested_height = (size+offset)* impulse.length
202
+ # else
203
+ # requested_width = (size+offset) * impulse.length
204
+ # requested_height = size
205
+ # end
206
+ # tool({ atome_id: :main_menu, parent: :intuition, color: { alpha: 0 } }.merge(position).merge(width: requested_width, height: requested_height))
207
+ # impulse.each_with_index do |item, index|
208
+ # if orientation == :vertical
209
+ # create_tool(item, size, 0, index * (size+offset))
210
+ # else
211
+ # create_tool(item, size, index * (size+offset), 0)
212
+ # end
213
+ # end
214
+ # end
215
+ # end
216
+ end
217
+ # atome class extension for eVe
218
+
219
+ class Atome
220
+ include Intuition
221
+ # def atome(requested_property)
222
+ # # add component list iin the content we maybe ahave to create a tool object because box can't handle this type of content
223
+ # new_atome=self.tool({ atome_id: "#{self.atome_id}_#{requested_property}_atome_#{self.content.length}", x: 66})
224
+ # new_atome.touch({ stop: true, option: :down}) do
225
+ # color(:red)
226
+ # new_atome.height = new_atome.height*3
227
+ # end
228
+ # new_atome.touch({ stop: true, option: :up}) do
229
+ # color(:red)
230
+ # new_atome.height = new_atome.height/3
231
+ # end
232
+ # notification "now we have to add an object or a new property (style) to store complete tool style including size and
233
+ # orientation so we can position the new atome correctly"
234
+ # # alert self.content.class
235
+ # # alert self.content.length
236
+ # # alert tool_style
237
+ # end
238
+ end
239
+
240
+ # # we initialise the toolbox here :
241
+ #
242
+ # # the launch bar
243
+ # launch_bar = box({ x: 0, y: 0, width: 33, height: "100%", parent: :intuition, z: 0, color: { alpha: 0 } })
244
+ # launch_bar.touch({ option: :long }) do |evt|
245
+ # size = 33
246
+ # yy_touch_position = grab(:view).convert(:height) - evt.page_y
247
+ # if yy_touch_position < size
248
+ # #if the long touch is within the wanted area( in this at bottom of the screen) we open the menu
249
+ # # launch_bar.open_intuition({ x: size, yy: 6,offset: 6, orientation: :horizontal, size: size })
250
+ # launch_bar.open_intuition({ x: 6, yy: size,offset: 6, orientation: :vertical, size: size })
251
+ # end
252
+ # end
253
+ #
254
+ # # # # # # # # # # # # # # # tests below # # # # # # # # # # # # #
255
+ #
256
+ # list = molecule_analysis(@molecules_list)
257
+ # notif list[:tools]
258
+ # notif "======"
259
+ # notif list[:molecules]
260
+ # notif "======"
261
+ # notif list[:atomes]
262
+ # notif "======"
263
+ # notif list[:molecules][:shadow]
264
+
265
+ new({ tool: :capture }) do |params|
266
+ tool = { id: :rec_01,
267
+
268
+ name: :record, icon: :record, action: {open: [:sub_menu]}, code: :record_tool, position: { root: 1 }, # position can be multiple
269
+ option: { opt1: :method_2 }, int8: { french: :enregistrement, english: :record, german: :datensatz } }
270
+ tool
271
+ end
272
+
273
+
274
+ puts A.impulse
275
+ # def fill_toolzone(tools_ids)
276
+ #
277
+ # end
278
+ #
279
+ # fill_toolzone(%i[files edition select group link copy undo settings])
280
+
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # return eVe version
4
+ module EVe
5
+ VERSION = '0.0.0.0.3'
6
+ end
7
+
8
+
9
+
10
+
11
+
@@ -754,8 +754,8 @@ class HTML
754
754
  parent_found = grab(option)
755
755
  min_left = parent_found.left
756
756
  min_top = parent_found.top
757
- parent_width = parent_found.width
758
- parent_height = parent_found.height
757
+ parent_width = parent_found.compute({ particle: :width })[:value]
758
+ parent_height = parent_found.compute({ particle: :height })[:value]
759
759
  original_width = @original_atome.width
760
760
  original_height = @original_atome.height
761
761
  max_left = min_left + parent_width - original_width
@@ -83,14 +83,9 @@
83
83
  # create a animation object
84
84
  # create callback methode when playing
85
85
 
86
-
87
- # here is how to animate shape :
88
- new({particle: :animate}) do |params|
89
- html.play_animation({ from: 0, to: 300, duration: 1000 })
90
- end
91
-
86
+ # # here is how to animate shape :
92
87
 
93
88
  b=box({id: :the_box})
94
89
 
95
- b.animate(true)
90
+ b.animate({ to: 90 })
96
91
 
@@ -20,13 +20,20 @@ wait 1 do
20
20
  b.apply([:active_color])
21
21
  end
22
22
  c = circle({ left: 333, id: :the_circle })
23
- wait 2 do
23
+ wait 1 do
24
+
25
+ puts "before: -------"
26
+ puts "c.attach #{c.attach}"
27
+ puts "b.attached : #{b.attached}"
28
+ puts "b.color : #{b.color}"
29
+ puts "c.color : #{c.color}"
24
30
  c.apply(:inactive_color)
25
31
  b.attached([c.id])
32
+ puts "After: -------"
26
33
 
27
34
  # Here is how to use it as a getter :
28
35
  # to retrieve witch atomes b315 is attached to to the atome c_12 just type
29
- puts "c.attach#{c.attach}" # => [:the_box]
36
+ puts "c.attach #{c.attach}" # => [:the_box]
30
37
  # to retrieve atome attached to the atome c_12 just type tha other method
31
38
  puts "b.attached : #{b.attached}" #=> [:the_circle]
32
39
  puts "b.color : #{b.color}"
@@ -41,9 +41,11 @@ a.width(33)
41
41
  a.height(33)
42
42
  a.top(33)
43
43
  a.left(33)
44
+ a.attach(:view)
44
45
  # we can now add a color the atome using apply used to apply an atome onto another (please note that color is also an atome not a particle)
45
46
  # in this case we apply the color atome name box_color this a default color created by the system
46
47
  a.apply([:box_color])
48
+
47
49
  wait 2 do
48
50
  # a bit less efficient and a bit more processor intensive solution is to use the box preset, that render a box too
49
51
  b=box
@@ -7,6 +7,10 @@ b=box({ left: 12, id: :the_first_box })
7
7
  b.category(:matrix)
8
8
  b.touch(true) do
9
9
  b.remove({ category: :matrix})
10
- t.data= " category is : #{b.category} + look in the browser console"
10
+ t.data= " category is : #{b.category}"
11
+ wait 1 do
12
+ b.category(:new_one)
13
+ t.data= " category is : #{b.category}"
14
+ end
11
15
  end
12
- t.data= " category is : #{b.category} + look in the browser console"
16
+ t.data= " category is : #{b.category} "
@@ -1,39 +1,39 @@
1
- # # frozen_string_literal: true
2
- #
3
- # A.message({ action: :insert, data: { table: :security, particle: :password, data: 'my_pass'} }) do |datas|
4
- # puts "0 data received: #{datas}"
5
- # end
6
- #
7
- # A.message({ action: :insert, data: { table: :identity, particle: :name, data: 'jeezs' } }) do |data_received_from_server|
8
- # puts "1 my first insert #{data_received_from_server}"
9
- # end
10
- #
11
- # A.message({ action: :insert, data: { table: :identity, particle: :name, data: 'jeezs2' } })
12
- #
13
- # A.message({ action: :query, data: { table: :identity } }) do |data_received_from_server|
14
- # puts "2 another insert : #{data_received_from_server}"
15
- # end
16
- #
17
- # A.message({ action: :query, data: { table: :identity } }) do |data_received|
18
- # puts "3 received : #{data_received}"
19
- # end
20
- #
21
- # A.message({ action: :insert, data: { table: :identity, particle: :name, data: 'jeezs3' } }) do |result|
22
- # puts "4 insert done : #{result}"
23
- # end
24
- #
25
- # A.message({ action: :insert, data: { table: :identity, particle: :name, data: 'jeezs4' } }) do |result|
26
- # puts "5 last message received: #{result}"
27
- # end
28
- #
29
- # A.message({ action: :insert, data: { table: :security, particle: :name, data: 'john doe' } }) do |data_received_from_server|
30
- # puts "6 test 1 : #{data_received_from_server}"
31
- # end
32
- #
33
- # A.message({ action: :insert, data: { table: :identity, particle: :tit, data: 'dummy' } }) do |data_received_from_server|
34
- # puts "7 test 2 : #{data_received_from_server}"
35
- # end
36
- #
37
- # A.message({ action: :insert, data: { table: :unknown, particle: :name, data: 'dummy2' } }) do |data_received_from_server|
38
- # puts "test 3 : #{data_received_from_server}"
39
- # end
1
+ # frozen_string_literal: true
2
+
3
+ A.message({ action: :insert, data: { table: :security, particle: :password, data: 'my_pass'} }) do |datas|
4
+ puts "0 data received: #{datas}"
5
+ end
6
+
7
+ A.message({ action: :insert, data: { table: :identity, particle: :name, data: 'jeezs' } }) do |data_received_from_server|
8
+ puts "1 my first insert #{data_received_from_server}"
9
+ end
10
+
11
+ A.message({ action: :insert, data: { table: :identity, particle: :name, data: 'jeezs2' } })
12
+
13
+ A.message({ action: :query, data: { table: :identity } }) do |data_received_from_server|
14
+ puts "2 another insert : #{data_received_from_server}"
15
+ end
16
+
17
+ A.message({ action: :query, data: { table: :identity } }) do |data_received|
18
+ puts "3 received : #{data_received}"
19
+ end
20
+
21
+ A.message({ action: :insert, data: { table: :identity, particle: :name, data: 'jeezs3' } }) do |result|
22
+ puts "4 insert done : #{result}"
23
+ end
24
+
25
+ A.message({ action: :insert, data: { table: :identity, particle: :name, data: 'jeezs4' } }) do |result|
26
+ puts "5 last message received: #{result}"
27
+ end
28
+
29
+ A.message({ action: :insert, data: { table: :security, particle: :name, data: 'john doe' } }) do |data_received_from_server|
30
+ puts "6 test 1 : #{data_received_from_server}"
31
+ end
32
+
33
+ A.message({ action: :insert, data: { table: :identity, particle: :tit, data: 'dummy' } }) do |data_received_from_server|
34
+ puts "7 test 2 : #{data_received_from_server}"
35
+ end
36
+
37
+ A.message({ action: :insert, data: { table: :unknown, particle: :name, data: 'dummy2' } }) do |data_received_from_server|
38
+ puts "test 3 : #{data_received_from_server}"
39
+ end
@@ -60,17 +60,18 @@ end
60
60
 
61
61
 
62
62
  Universe.user_atomes.each do |atome_id|
63
- atome_found = grab(atome_id)
63
+ atome_found = hook(atome_id)
64
64
  if atome_found.type == :shape
65
65
  atome_found.color(:orange)
66
66
  atome_found.smooth(200)
67
67
  atome_found.top(200)
68
68
  end
69
69
  end
70
- #
70
+
71
+
71
72
  random_found =Universe.user_atomes.sample(7)
72
73
  random_found.each do |atome_id|
73
- atome_found = grab(atome_id)
74
+ atome_found = hook(atome_id)
74
75
  if atome_found.type == :shape
75
76
  atome_found.top(rand(600))
76
77
  atome_found.width(rand(120))
@@ -82,7 +83,7 @@ end
82
83
 
83
84
  random_found =Universe.user_atomes.sample(9)
84
85
  random_found.each do |atome_id|
85
- atome_found = grab(atome_id)
86
+ atome_found = hook(atome_id)
86
87
  if atome_found.type == :shape
87
88
  atome_found.left(rand(700))
88
89
  atome_found.width(rand(120))
@@ -9,7 +9,7 @@ end
9
9
 
10
10
 
11
11
  Universe.user_atomes.each do |atome_id|
12
- atome_found = grab(atome_id)
12
+ atome_found = hook(atome_id)
13
13
  if atome_found.type == :shape
14
14
  atome_found.color(:orange)
15
15
  atome_found.smooth(200)
@@ -19,7 +19,7 @@ end
19
19
 
20
20
  random_found =Universe.user_atomes.sample(7)
21
21
  random_found.each do |atome_id|
22
- atome_found = grab(atome_id)
22
+ atome_found = hook(atome_id)
23
23
  if atome_found.type == :shape
24
24
  atome_found.top(rand(600))
25
25
  atome_found.width(rand(120))
@@ -31,7 +31,7 @@ end
31
31
 
32
32
  random_found =Universe.user_atomes.sample(9)
33
33
  random_found.each do |atome_id|
34
- atome_found = grab(atome_id)
34
+ atome_found = hook(atome_id)
35
35
  if atome_found.type == :shape
36
36
  atome_found.left(rand(700))
37
37
  atome_found.width(rand(120))
@@ -9,7 +9,7 @@ first_repeater=repeat(1, repeat = 99) do |counter|
9
9
  t1.data(counter)
10
10
  end
11
11
 
12
- my_repeater=repeat(3, repeat = 9) do |counter|
12
+ my_repeater=repeat(1, repeat = 9) do |counter|
13
13
  t2.data(counter)
14
14
  end
15
15
 
@@ -1,6 +1 @@
1
- # frozen_string_literal: true
2
-
3
- my_pass = Black_matter.encode('hell')
4
- puts my_pass
5
- checker = Black_matter.check_password('hello,', my_pass)
6
- puts checker
1
+ # frozen_string_literal: true
@@ -3,7 +3,14 @@
3
3
  # server utils to handle eDen Db
4
4
 
5
5
  class EDen
6
+
7
+ @@mail = nil
8
+ @@pass = nil
6
9
  class << self
10
+
11
+ @@mail = nil
12
+ @@pass = nil
13
+
7
14
  def db_access
8
15
  Database.db_access
9
16
  end
@@ -12,39 +19,62 @@ class EDen
12
19
  { data: { message: `#{data}` }, message_id: message_id }
13
20
  end
14
21
 
15
- def authorization(data, message_id)
16
- db = db_access
17
- security_items = db[:security]
18
- user_password = data["password"]
19
- user_exists = security_items.where(password: user_password).first
20
-
21
- if !user_exists
22
- { return: 'Password not found', message_id: message_id }
23
- # Ask to the user if he wants to subscribe
24
- # Send the basic template
25
- else
26
- { return: 'Password found, connected', message_id: message_id }
27
- # Send the user account template
28
- end
22
+ def sanitize_email(email)
23
+ invalid_chars_pattern = /[^a-zA-Z0-9.-@]+/
24
+ email.gsub(invalid_chars_pattern, '')
29
25
  end
30
26
 
31
27
  def authentication(data, message_id)
32
- # { data: { message: 'login received' }, message_id: message_id }
28
+ # database connexion :
33
29
  db = db_access
30
+ # retrieving data from the 'identity' table
34
31
  identity_items = db[:identity]
32
+ # retrieving sent data
35
33
  user_email = data["email"]
36
- mail_exists = identity_items.where(email: user_email).first
34
+ # data cleansing of superfluous characters
35
+ sanitized_email = sanitize_email(user_email)
36
+ # database search
37
+ mail_exists = identity_items.where(email: sanitized_email).first
37
38
 
38
39
  if !mail_exists
39
- { return: 'Email not found', message_id: message_id }
40
- # { return: user_email, message_id: message_id }
41
- # Ask to the user if he wants to subscribe
42
- # Send the basic template
40
+ return { return: 'Email non trouvé, erreur', authorized: false, message_id: message_id }
41
+ else
42
+ @@mail = user_email
43
+ if @@mail && @@pass
44
+ @@mail = nil
45
+ @@pass = nil
46
+ return { return: 'logged', authorized: true, message_id: message_id }
47
+ # Send the user account template
48
+ else
49
+ return { return: 'Email trouvé, cherche mdp', authorized: true, message_id: message_id }
50
+ end
51
+ end
52
+ end
53
+
54
+ def authorization(data, message_id)
55
+ # database connexion :
56
+ db = db_access
57
+ # retrieving data from the 'security' table
58
+ security_items = db[:security]
59
+ # retrieving sent data
60
+ user_password = data["password"]
61
+ # database search
62
+ user_exists = security_items.where(password: user_password).first
63
+
64
+ if !user_exists
65
+ puts "password recu : :#{user_password}, @@mail : #{ @@mail} , pass : #{ @@pass}"
66
+ return { return: 'Password non trouvé, erreur', authorized: false, message_id: message_id }
43
67
  else
44
- { return: 'Email found, looking for pass', message_id: message_id }
45
- # Verify password
46
- # If password isn't ok, send error
47
- # If the password is ok, send the user account template
68
+ @@pass = user_password
69
+ if @@mail && @@pass
70
+ # reset variables containing mail and password
71
+ @@mail = nil
72
+ @@pass = nil
73
+ return { return: 'logged', authorized: true, message_id: message_id }
74
+ # Send the user account template
75
+ else
76
+ return { return: 'Password trouvé, cherche mdp', authorized: true, message_id: message_id }
77
+ end
48
78
  end
49
79
  end
50
80
 
@@ -108,5 +138,4 @@ class EDen
108
138
  send(method_sym, data, message_id)
109
139
  end
110
140
  end
111
-
112
141
  end
@@ -38,7 +38,12 @@
38
38
  require '/utilities/aui'
39
39
  require '/utilities/host_mode'
40
40
  require '/lib/atome_relative'
41
- require './index'
41
+ # if Universe.eVe
42
+ # require './index'
43
+ #else
44
+ # require './index'
45
+ # end
46
+ require './index'
42
47
  #puts Universe.host
43
48
  atome_infos
44
49
  </script>